<template>
  <div class="flex-item flex-right flex-column flex-middle step">
    <image v-if="number>0" @click="$emit('change',{index,isAdd:false,otherParams})" :src="icons[1]"></image>
    <div v-if="number>0">{{number}}</div>
    <image @click="$emit('change',{index,isAdd:true, otherParams})" :src="icons[0]"></image>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        icons: ['/static/icon-jia.png', '/static/icon-jian.png'],
      }
    },
    props: {
      number: {
        type: Number,
        default: 0
      },
      // 购物车里
      index: {
        type: Number,
        default: 0,
      },
      // 订单选择里需要两个参数
      otherParams: {
        type: Array,
        default: function(){
          return []
        }
      }
    },
    created() {
      console.log('..')
    },
  }
</script>

<style lang="less" scoped>
.step {
    margin-right: 12px;
    color: #555;
    font-size: 15px;
    image {
      height: 20px;width: 20px;
      margin:0 8px;
    }
  }
</style>